﻿<div id="content">
    <div smart-include="sensor/views/sub-header.tpl.html"></div>
    <div class="clearfix margin-bottom-10">
        <div class="pull-left margin-right-20">
            <a class="btn btn-labeled btn-primary" data-toggle="modal" data-target="#addAlert"> <span class="btn-label"><i class="glyphicon glyphicon-plus"></i></span>添加字段</a>
        </div>
    </div>
    <div class="table-responsive">
        <table class="table table-bordered table-hover no-margin font-sml table-striped sensor_table">
            <thead>
                <tr>
                    <th style="width: 10%">操作</th>
                    <th class="text-align-center">字段名</th>
                    <th class="text-align-center">类型</th>
                    <th class="text-align-center">长度</th>
                    <th class="text-align-center">描述</th>
                </tr>
            </thead>
            <tbody>
                <tr ng-repeat="data in datas">
                    <td>
                        <button ng-disabled="{{data.status}}" class='btn btn-xs btn-default' uib-tooltip='编辑' tooltip-append-to-body='true' data-toggle="modal" data-target="#editAlert" ng-click="showEditAlert(data)"><i class='fa fa-pencil'></i></button>
                        <button ng-disabled="{{data.status}}"class='btn btn-xs btn-default' uib-tooltip='删除' tooltip-append-to-body='true'data-toggle="modal" data-target="#delAlert" ng-click="showDelDialog(data.COLUMN_NAME)"><i class='fa fa-times'></i></button>
                    </td>
                    <td class="text-align-center">{{data.COLUMN_NAME}}</td>
                    <td class="text-align-center">{{data.DATA_TYPE}}</td>
                    <th class="text-align-center">{{data.COLUMN_TYPE}}</th>
                    <td class="text-align-center">{{data.column_comment}}</td>
                </tr>
            </tbody>
        </table>
    </div>
    <!-- end widget content -->
    <!--<div class="dt-toolbar-footer">
        &lt;!&ndash; <tm-pagination conf="paginationConf"></tm-pagination> &ndash;&gt;
    </div>-->

    <div class="modal fade" id="addAlert" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <h4 class="modal-title">添加</h4>
                </div>
                <div class="modal-body">
                    <form  class="form-horizontal">
                        <div class="form-group">
                            <label class="col-sm-2  col-xs-12 control-label">名称</label>
                            <div class="col-sm-9">
                              <input type="text"  ng-model="addobj.name" class="form-control" placeholder="名称(不能单独输入数字)">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2  col-xs-12 control-label">类型</label>
                            <div class="col-sm-9">
                              <select ng-model="addobj.type" class="form-control" ng-change="type(addobj.type)">
                                  <option value="{{type.name}}" ng-repeat = "type in types">{{type.val}}</option>
                              </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2  col-xs-12 control-label">描述</label>
                            <div class="col-sm-9">
                              <input type="text"  ng-model="addobj.des" class="form-control" placeholder="描述">
                            </div>
                        </div>
                        <div class="form-group" ng-show="Length_dom">
                            <label class="col-sm-2 col-xs-12 control-label">长度</label>
                            <div class="col-sm-6 col-xs-7">
                                <input type="text"  ng-model="Length" class="form-control" placeholder="长度(只能是数字)">
                            </div>
                            <div class="col-sm-3 col-xs-5">
                                <span class="pull-right" style="line-height:32px">(单位：<b>字节</b>)</span>
                            </div>
                        </div>
                        <div class="form-group" ng-show="Length_dom124">
                            <label class="col-sm-2 col-xs-12 control-label">长度</label>
                            <div class="col-sm-6 col-xs-7">
                                <div class="btn-group">
                                    <button type="button" class="btn btn-default btn_124">1</button>
                                    <button type="button" class="btn btn-default btn_124">2</button>
                                    <button type="button" class="btn btn-default btn_124">4</button>
                                </div>
                            </div>
                            <div class="col-sm-3 col-xs-5">
                                <span class="pull-right" style="line-height:32px">(单位：<b>字节</b>)</span>
                            </div>
                        </div>

                    </form>
                </div>
                <div class="modal-footer">
                    <button class="btn btn-default"data-dismiss="modal">关闭</button>
                    <button class="btn btn-primary" ng-click="sure_add()">提交</button>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->
    <div class="modal fade in" id="editAlert" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <h4 class="modal-title">编辑</h4>
                </div>
                <div class="modal-body">
                    <form  class="form-horizontal">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">名称</label>
                            <div class="col-sm-9">
                              <input type="text" ng-model="editobj.name" class="form-control" placeholder="名称">
                            </div>
                        </div>  
                        <div class="form-group">
                            <label class="col-sm-2 control-label">类型</label>
                            <div class="col-sm-9">
                                <select ng-model="editobj.type" class="form-control">
                                    <option value="{{type.name}}" ng-repeat = "type in types">{{type.name}}</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">描述</label>
                            <div class="col-sm-9">
                              <input type="text" ng-model="editobj.des" class="form-control" placeholder="描述">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">长度</label>
                            <div class="col-sm-9">
                                <input type="text" ng-model="editLength" class="form-control" placeholder="长度">
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button class="btn btn-default"data-dismiss="modal">关闭</button>
                    <button class="btn btn-primary" ng-click="sure_edit()">提交</button>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->
    <div class="modal fade in" id="delAlert" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        ×
                    </button>
                    <h4 class="modal-title">信息</h4>
                </div>
                <div class="modal-body">
                    <p>
                        您确实要删除这个字段吗？
                    </p>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">
                        关闭
                    </button>
                    <button type="button" class="btn btn-primary" ng-click="sure_del()">
                        确认
                    </button>
                </div>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
    <!-- /.modal-dialog -->
</div>
<!-- END MAIN CONTENT